#include "bits/stdc++.h"
using namespace std;

void backtrack(vector<int>& skills, vector<int>& demage, vector<int>& mem, int hp, int& operate, int steps){
    if(hp <= 0){
        operate = min(operate, steps);
        return;
    }

    for(int i = 0; i<skills.size(); i++){
        if(mem[i] == 0){
            mem[i] = 1;
            int this_demage = skills[i];
            if(demage[i] >= hp) this_demage *= 2;
            backtrack(skills, demage, mem, hp-this_demage, operate, steps+1);
            mem[i] = 0;
        }
    }

}

int main(int argc, char* argv[]){

    int T;
    cin >> T;

    int n, m;
    vector<int> skills;
    vector<int> demage;
    vector<int> mem;
    int operate;

    while(T--){
        
        cin>>n>>m;
        skills.resize(n);
        demage.resize(n);
        mem.resize(n);
        operate = INT_MAX;
        
        for(int i=0; i<n; i++){
            cin>>skills[i]>>demage[i];
            mem[i] = 0;
        }

        backtrack(skills, demage, mem, m, operate, 0);
        if(operate == INT_MAX) operate = -1;

        cout<< operate <<endl;
    }

    return 0;
}